/*
 * NamedStep.java
 *
 * Created on February 28, 2007, 5:53 PM
 *
 * (C) R. Alexander Milowski alex@milowski.com
 */

package com.smallx.xpath.streaming;

import org.infoset.xml.Item;
import org.infoset.xml.Name;
import org.infoset.xml.Named;

/**
 *
 * @author R. Alexander Milowski
 */
public abstract class NamedStep extends Step {

   Name name;
   /** Creates a new instance of NamedStep */
   public NamedStep() {
      name = null;
   }
   
   public void setName(Name name) {
      this.name = name;
   }
   
   protected boolean match(Item item) {
      if (name!=null) {
         return item instanceof Named ? ((Named)item).getName().equals(name) : true;
      }
      return item instanceof Named;
   }
   
}
